package com.esri.core.ogc;

import java.util.Stack;
import org.xml.sax.Attributes;

/* loaded from: classes.dex */
public abstract class OwsItem {
    protected Stack<String> mStack = new Stack<>();
    protected StringBuilder mData = null;

    /* JADX INFO: Access modifiers changed from: protected */
    public String getCurrentTagName() {
        return !this.mStack.empty() ? this.mStack.peek() : "";
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public int getStackSize() {
        return this.mStack.size();
    }

    public void startElement(String str, Attributes attributes) {
        this.mStack.push(str);
        this.mData = new StringBuilder();
    }

    public void endElement(String str) {
        if (!this.mStack.isEmpty()) {
            this.mStack.pop();
        }
        this.mData = null;
    }

    public void characters(char[] cArr, int i, int i2) {
        StringBuilder sb;
        String str = new String(cArr, i, i2);
        if (this.mStack.isEmpty() || (sb = this.mData) == null) {
            return;
        }
        sb.append(str);
    }
}
